package com.example.test06thread.test.synch;

public class DeadLock3 {
    public static void main(String[] args) {
        new Thread(()->{
            A a = new A();
        }).start();
        new Thread(()->{
            B b = new B();
        }).start();
    }
}
class A{
    static {
        try {
            Thread.sleep(100);
            System.out.println("正在执行B的初始化方法");
            Class.forName("com.example.test06thread.test.synch.B");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
class B{
    static {
        try {
            Thread.sleep(100);
            System.out.println("正在执行A的初始化方法");
            Class.forName("com.example.test06thread.test.synch.A");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}